home *** CD-ROM | disk | FTP | other *** search
- /*==================================================================
- * File : request.c
- * Package: Xprof
- *
- * Author : Aloke Gupta.
- *
- * (C) Copyright 1992, Aloke Gupta.
- *==================================================================*/
-
- /*
- * Processing routines for the requests seen in the message stream.
- * Functions:
- * 1. process_request(FILE *fp, char *string, GlobalStats *globalstats)
- * 2. print_request_stats(FILE *fp)
- * 3. The routines to process each request seen. These have the format:
- * Request(FILE *fp, request_index, current_time)
- */
- #include <stdio.h>
- #include "common.h"
- #include "profile.h"
-
- MsgStats TotalRequestStats; /* Overall stats for all requests */
- MsgStats RequestStats[MAXREQUESTS]; /* Detailed stats for each request */
-
- static char in_string[MAXSTRINGSIZE]; /* Buffer to read a record into */
- static char sbuf[132], sbuf1[132], sbuf2[132]; /* Temp. slots for sscanf*/
-
- extern MsgType RequestType[];
- extern int lookup_request();
-
- static Xattributes attributes; /* Attributes of current message */
-
- XprofGCvalues *create_gcval();
- XprofGCvalues *get_gcval();
- FontVal *create_fontval();
- FontVal *get_fontval();
-
- process_request(fp, string, gstats)
- FILE *fp; /* Pointer to input stream */
- char *string;
- GlobalStats *gstats;
- {
- char request_name[80]; /* Name of the current request */
- int request_index; /* Index in the data structures */
- long bytes=0; /* number of bytes */
-
- /* Initialize the data structures. */
- if (TotalRequestStats.invoked == FALSE)
- InitMsgStats(&TotalRequestStats, gstats->current_time,DETAILED,GRAIN1);
- /*
- * Zero out the attributes structure. This is modified as a side effect by
- * many of the action functions
- */
- bzero((char *) &attributes, sizeof(Xattributes));
-
- sscanf(string, "%s %s",sbuf, request_name);
-
- request_index = lookup_request(request_name);
-
- /* Call the action for this request */
- /* The action will fill the MsgStats for the request and also update
- * the profile
- */
- bytes = RequestType[request_index].action(fp, request_index,
- gstats->current_time);
- /*
- * Fill the data structure for the total of the requests. The size
- * distribution is maintained for the total number of bytes received.
- */
- FillMsgStats(&TotalRequestStats, gstats->current_time, bytes, bytes);
-
- gstats->request_bytes += bytes;
- }
-
- print_request_stats(fp)
- FILE *fp;
- {
- int i;
- char *dashes = "---------------------------------------------------------------";
-
-
- if (TotalRequestStats.invoked == FALSE)
- return;
- /*
- * Print the details for all Requests together
- */
- PrintMsgStats(fp,&TotalRequestStats, "REQUESTS ");
-
- /*
- * Brief table for the numbers and byte totals for the requests
- */
- fprintf(fp, "\t%s\n", dashes);
- fprintf(fp,"%-25s", " REQUEST messages");
- fprintf(fp,"%25s", "Total Bytes ");
- fprintf(fp," %19s\n","Number ");
- fprintf(fp, "\t%s\n", dashes);
- for (i = 0; i < MAXREQUESTS; i++)
- if (RequestStats[i].invoked == TRUE) {
- fprintf(fp,"%-25s", RequestType[i].name);
- fprintf(fp," %10ld bytes",RequestStats[i].total_bytes);
- fprintf(fp," (%5.2f%%)", (float) 100 * RequestStats[i].total_bytes /
- TotalRequestStats.total_bytes);
- fprintf(fp," %10ld", RequestStats[i].number );
- fprintf(fp," (%5.2f%%)", (float) 100 * RequestStats[i].number /
- TotalRequestStats.number);
- fprintf(fp,"\n");
- }
- fprintf(fp, "\t%s\n", dashes);
- fprintf(fp,"%25s"," Grand Total ");
- fprintf(fp," %10ld bytes ", TotalRequestStats.total_bytes);
- fprintf(fp," %10ld \n", TotalRequestStats.number);
- fprintf(fp, "\t%s\n", dashes);
- if (verboselevel > 0) {
- for (i = 0; i < MAXREQUESTS; i++)
- if (RequestStats[i].detailed == DETAILED)
- PrintMsgStats(fp,&RequestStats[i], RequestType[i].name);
- }
- /*
- * Now dump the raw statistics for the messages
- */
- if (verboselevel > 1) {
- if (TotalRequestStats.detailed == DETAILED)
- PrintMsgDetails(fp,&TotalRequestStats, "REQUESTS ");
-
- for (i = 0; i < MAXREQUESTS; i++)
- if (RequestStats[i].detailed == DETAILED)
- PrintMsgDetails(fp,&RequestStats[i], RequestType[i].name);
- }
- return;
- }
-
- /*
- * OpenFont: Opcode 45
- * Size: 0 (Irrelevant)
- */
- long OpenFont(fp, num, current_time)
- FILE *fp; /* Data stream */
- int num; /* Number of the request */
- long current_time; /* Current time in ms */
- {
- long bytes;
- int max_slots = 3; /* Maximum number of data slots to fill */
- int length;
- long fontid;
- Boolean fd_length = FALSE, fd_fontid = FALSE, fd_name = FALSE;
- int fd_all=0; /* All found ? */
- char *ptr;
- FontVal *fontval;
- int strlength;
-
- if (RequestStats[num].invoked == FALSE)
- InitMsgStats(&RequestStats[num],current_time,RequestType[num].detailed,
- RequestType[num].size_grain);
- /*
- * Get a record and fill all the slots
- */
- while (fd_all < max_slots) {
- if (fgets(in_string,MAXSTRINGSIZE,fp) == NULL)
- return(0);
- _LINE_NUM++;
- ptr = in_string;
- while (isspace(*ptr)) ptr++; /* Remove leading white space */
- if ((fd_length==FALSE) && (t_search(ptr,"request length:")!= 0)) {
- sscanf(ptr,"%s %s %x", sbuf1, sbuf2, &length);
- fd_length = TRUE; fd_all ++;
- continue;
- }
- else if ((fd_fontid==FALSE)&&(t_search(ptr,"font-id:")!= 0)){
- sscanf(ptr,"%s %s %lx", sbuf1, sbuf2, &fontid);
- fd_fontid = TRUE; fd_all ++;
- continue;
- }
- else if ((fd_name==FALSE)&&(t_search(ptr,"name:")!= 0)){
- sscanf(ptr,"%s %s", sbuf1, sbuf2);
- fd_name = TRUE; fd_all ++;
- continue;
- }
- } /* while */
-
- /*
- * Create and fill the FontVal structure for this font
- */
- fontval = create_fontval(fontid);
- strlength = strlen(sbuf2);
- sbuf2[--strlength] = '\0';
- fontval->fontname= malloc(strlen(sbuf2));
- strcpy(fontval->fontname, sbuf2+1);
-
- /*
- * Fill the data Structure for this message
- */
- bytes = length * 4;
- attributes.bytes = bytes;
- attributes.size = 0.0;
- update_profile(num, &attributes);
- FillMsgStats(&RequestStats[num], current_time,
- (long) 0, bytes);
- return (bytes);
- } /* OpenFont */
-
- /*
- * CloseFont: Opcode 46
- * Size: 0 (Irrelevant)
- */
- long CloseFont(fp, num, current_time)
- FILE *fp; /* Data stream */
- int num; /* Number of the request */
- long current_time; /* Current time in ms */
- {
- long bytes;
- int max_slots = 2; /* Maximum number of data slots to fill */
- int length;
- long fontid;
- Boolean fd_length = FALSE, fd_fontid = FALSE;
- int fd_all=0; /* All found ? */
- char *ptr;
-
- if (RequestStats[num].invoked == FALSE)
- InitMsgStats(&RequestStats[num],current_time,RequestType[num].detailed,
- RequestType[num].size_grain);
- /*
- * Get a record and fill all the slots
- */
- while (fd_all < max_slots) {
- if (fgets(in_string,MAXSTRINGSIZE,fp) == NULL)
- return(0);
- _LINE_NUM++;
- ptr = in_string;
- while (isspace(*ptr)) ptr++; /* Remove leading white space */
- if ((fd_length==FALSE) && (t_search(ptr,"request length:")!= 0)) {
- sscanf(ptr,"%s %s %x", sbuf1, sbuf2, &length);
- fd_length = TRUE; fd_all ++;
- continue;
- }
- else if ((fd_fontid==FALSE)&&(t_search(ptr,"font:")!= 0)){
- sscanf(ptr,"%s %s %lx", sbuf1, sbuf2, &fontid);
- fd_fontid = TRUE; fd_all ++;
- continue;
- }
- } /* while */
-
- /* Clear out the font */
- free_fontval(fontid);
- /*
- * Fill the data Structure for this message
- */
- bytes = length * 4;
- attributes.bytes = bytes;
- attributes.size = 0.0;
- update_profile(num, &attributes);
- FillMsgStats(&RequestStats[num], current_time,
- (long) 0, bytes);
- return (bytes);
- } /* CloseFont */
-
- /*
- * CreateGC: Opcode 55
- * Size: 0 (Irrelevant)
- */
- long CreateGC(fp, num, current_time)
- FILE *fp; /* Data stream */
- int num; /* Number of the request */
- long current_time; /* Current time in ms */
- {
- XprofGCvalues *gcval; /* pointer to a relevent graphics context */
- long bytes;
- int max_slots = 4; /* Maximum number of data slots to fill */
- int length, valmask=0;
- long gcid;
- Boolean fd_length = FALSE, fd_gcid = FALSE;
- Boolean fd_valmask = FALSE, fd_vallist = FALSE;
- int fd_all=0; /* All found ? */
- char *ptr;
-
- gcval = create_gcval(0); /* Allocate gcval with gcid = 0 (reset below) */
- if (RequestStats[num].invoked == FALSE)
- InitMsgStats(&RequestStats[num],current_time,RequestType[num].detailed,
- RequestType[num].size_grain);
- /*
- * Get a record and fill all the slots
- */
- while (fd_all < max_slots) {
- if (fgets(in_string,MAXSTRINGSIZE,fp) == NULL)
- return(0);
- _LINE_NUM++;
- ptr = in_string;
- while (isspace(*ptr)) ptr++; /* Remove leading white space */
- if ((fd_length==FALSE) && (t_search(ptr,"request length:")!= 0)) {
- sscanf(ptr,"%s %s %x", sbuf1, sbuf2, &length);
- fd_length = TRUE; fd_all ++;
- continue;
- }
- else if ((fd_gcid==FALSE)&&(t_search(ptr,"graphic-context-id:")!= 0)){
- sscanf(ptr,"%s %s %lx", sbuf1, sbuf2, &gcid);
- fd_gcid = TRUE; fd_all ++;
- gcval->id = gcid;
- continue;
- }
- else if ((fd_valmask==FALSE)&&(t_search(ptr,"value-mask:")!= 0)){
- fd_valmask = TRUE; fd_all ++;
- fill_gcmask(ptr, &valmask);
- if (valmask == 0) {
- fd_vallist = TRUE; fd_all ++; /* No values are to be set */
- }
- continue;
- }
- else if ((fd_vallist==FALSE)&&(t_search(ptr,"value-list:")!= 0)){
- fd_vallist = TRUE; fd_all ++;
- /*
- * Now search for all the values that have been set
- */
- fill_gcval(fp, valmask, gcval);
- continue;
- }
- } /* while */
- fflush(stdout);
- /*
- * Fill the data Structure for this message
- */
- attributes.gcval = gcval;
- bytes = length * 4;
- attributes.bytes = bytes;
- attributes.size = 0.0;
- update_profile(num, &attributes);
- FillMsgStats(&RequestStats[num], current_time,
- (long) 0, bytes);
- return (bytes);
- } /* CreateGC */
-
- /*
- * ChangeGC: Opcode 55
- * Size: 0 (Irrelevant)
- */
- long ChangeGC(fp, num, current_time)
- FILE *fp; /* Data stream */
- int num; /* Number of the request */
- long current_time; /* Current time in ms */
- {
- XprofGCvalues *gcval; /* pointer to a relevent graphics context */
- long bytes;
- int max_slots = 4; /* Maximum number of data slots to fill */
- int length, valmask=0;
- long gcid;
- Boolean fd_length = FALSE, fd_gcid = FALSE;
- Boolean fd_valmask = FALSE, fd_vallist = FALSE;
- int fd_all=0; /* All found ? */
- char *ptr;
-
- if (RequestStats[num].invoked == FALSE)
- InitMsgStats(&RequestStats[num],current_time,RequestType[num].detailed,
- RequestType[num].size_grain);
- /*
- * Get a record and fill all the slots
- */
- while (fd_all < max_slots) {
- if (fgets(in_string,MAXSTRINGSIZE,fp) == NULL)
- return(0);
- _LINE_NUM++;
- ptr = in_string;
- while (isspace(*ptr)) ptr++; /* Remove leading white space */
- if ((fd_length==FALSE) && (t_search(ptr,"request length:")!= 0)) {
- sscanf(ptr,"%s %s %x", sbuf1, sbuf2, &length);
- fd_length = TRUE; fd_all ++;
- continue;
- }
- else if ((fd_gcid==FALSE)&&(t_search(ptr,"gc:")!= 0)){
- sscanf(ptr,"%s %s %lx", sbuf1, sbuf2, &gcid);
- fd_gcid = TRUE; fd_all ++;
- gcval = get_gcval(gcid);
- continue;
- }
- else if ((fd_valmask==FALSE)&&(t_search(ptr,"value-mask:")!= 0)){
- fd_valmask = TRUE; fd_all ++;
- fill_gcmask(ptr, &valmask);
- if (valmask == 0) {
- fd_vallist = TRUE; fd_all ++; /* No values are to be set */
- }
- continue;
- }
- else if ((fd_vallist==FALSE)&&(t_search(ptr,"value-list:")!= 0)){
- fd_vallist = TRUE; fd_all ++;
- /*
- * Now search for all the values that have been set
- */
- fill_gcval(fp, valmask, gcval);
- continue;
- }
- } /* while */
- fflush(stdout);
- /*
- * Fill the data Structure for this message
- */
- attributes.gcval = gcval;
- bytes = length * 4;
- attributes.bytes = bytes;
- attributes.size = 0.0;
- update_profile(num, &attributes);
- FillMsgStats(&RequestStats[num], current_time,
- (long) 0, bytes);
- return (bytes);
- } /* ChangeGC */
-
- /*
- * CopyGC: Opcode 57
- * Size: 0 (Irrelevant)
- */
- long CopyGC(fp, num, current_time)
- FILE *fp; /* Data stream */
- int num; /* Number of the request */
- long current_time; /* Current time in ms */
- {
- long bytes;
- int max_slots = 4; /* Maximum number of data slots to fill */
- int length, valmask=0;
- long src_gcid, dst_gcid;
- Boolean fd_length = FALSE, fd_srcgcid = FALSE;
- Boolean fd_dstgcid = FALSE, fd_valmask = FALSE;
- int fd_all=0; /* All found ? */
- char *ptr;
-
- if (RequestStats[num].invoked == FALSE)
- InitMsgStats(&RequestStats[num],current_time,RequestType[num].detailed,
- RequestType[num].size_grain);
- /*
- * Get a record and fill all the slots
- */
- while (fd_all < max_slots) {
- if (fgets(in_string,MAXSTRINGSIZE,fp) == NULL)
- return(0);
- _LINE_NUM++;
- ptr = in_string;
- while (isspace(*ptr)) ptr++; /* Remove leading white space */
- if ((fd_length==FALSE) && (t_search(ptr,"request length:")!= 0)) {
- sscanf(ptr,"%s %s %x", sbuf1, sbuf2, &length);
- fd_length = TRUE; fd_all ++;
- continue;
- }
- else if ((fd_srcgcid==FALSE)&&(t_search(ptr,"src-gc:")!= 0)){
- sscanf(ptr,"%s %s %lx", sbuf1, sbuf2, &src_gcid);
- fd_srcgcid = TRUE; fd_all ++;
- continue;
- }
- else if ((fd_dstgcid==FALSE)&&(t_search(ptr,"dst-gc:")!= 0)){
- sscanf(ptr,"%s %s %lx", sbuf1, sbuf2, &dst_gcid);
- fd_dstgcid = TRUE; fd_all ++;
- continue;
- }
- else if ((fd_valmask==FALSE)&&(t_search(ptr,"value-mask:")!= 0)){
- fd_valmask = TRUE; fd_all ++;
- fill_gcmask(ptr, &valmask);
- continue;
- }
- } /* while */
-
- copy_gcval(src_gcid, dst_gcid, valmask);
- /*
- * Fill the data Structure for this message
- */
- bytes = length * 4;
- attributes.bytes = bytes;
- attributes.size = 0.0;
- update_profile(num, &attributes);
- FillMsgStats(&RequestStats[num], current_time,
- (long) 0, bytes);
- return (bytes);
- } /* CopyGC */
-
- /*
- * FreeGC: Opcode 60
- * Size: 0 (Irrelevant)
- */
- long FreeGC(fp, num, current_time)
- FILE *fp; /* Data stream */
- int num; /* Number of the request */
- long current_time; /* Current time in ms */
- {
- long bytes;
- int max_slots = 2; /* Maximum number of data slots to fill */
- int length;
- long gcid;
- Boolean fd_length = FALSE, fd_gcid = FALSE;
- int fd_all=0; /* All found ? */
- char *ptr;
-
- if (RequestStats[num].invoked == FALSE)
- InitMsgStats(&RequestStats[num],current_time,RequestType[num].detailed,
- RequestType[num].size_grain);
- /*
- * Get a record and fill all the slots
- */
- while (fd_all < max_slots) {
- if (fgets(in_string,MAXSTRINGSIZE,fp) == NULL)
- return(0);
- _LINE_NUM++;
- ptr = in_string;
- while (isspace(*ptr)) ptr++; /* Remove leading white space */
- if ((fd_length==FALSE) && (t_search(ptr,"request length:")!= 0)) {
- sscanf(ptr,"%s %s %x", sbuf1, sbuf2, &length);
- fd_length = TRUE; fd_all ++;
- continue;
- }
- else if ((fd_gcid==FALSE)&&(t_search(ptr,"gc:")!= 0)){
- sscanf(ptr,"%s %s %lx", sbuf1, sbuf2, &gcid);
- fd_gcid = TRUE; fd_all ++;
- continue;
- }
- } /* while */
- free_gcval(gcid);
- /*
- * Fill the data Structure for this message
- */
- bytes = length * 4;
- attributes.bytes = bytes;
- attributes.size = 0.0;
- update_profile(num, &attributes);
- FillMsgStats(&RequestStats[num], current_time,
- (long) 0, bytes);
- return (bytes);
- } /* FreeGC */
-
- /*
- * ClearArea: Opcode 61
- * Size: Area of image (height * width).
- */
- long ClearArea(fp, num, current_time)
- FILE *fp; /* Data stream */
- int num; /* Number of the request */
- long current_time; /* Current time in ms */
- {
- long bytes;
- int max_slots = 3; /* Maximum number of data slots to fill */
- int length, width, height;
- Boolean fd_length = FALSE, fd_width = FALSE, fd_height = FALSE;
- int fd_all=0; /* All found ? */
- char *ptr;
-
- if (RequestStats[num].invoked == FALSE)
- InitMsgStats(&RequestStats[num],current_time,RequestType[num].detailed,
- RequestType[num].size_grain);
- /*
- * Get a record and fill all the slots
- */
- while (fd_all < max_slots) {
- if (fgets(in_string,MAXSTRINGSIZE,fp) == NULL)
- return(0);
- _LINE_NUM++;
- ptr = in_string;
- while (isspace(*ptr)) ptr++; /* Remove leading white space */
- if ((fd_length==FALSE) && (t_search(ptr,"request length:")!= 0)) {
- sscanf(ptr,"%s %s %x", sbuf1, sbuf2, &length);
- fd_length = TRUE; fd_all ++;
- continue;
- }
- else if ((fd_width==FALSE)&&(t_search(ptr,"width:")!= 0)){
- sscanf(ptr,"%s %x", sbuf1, &width);
- fd_width = TRUE; fd_all ++;
- continue;
- }
- else if ((fd_height==FALSE)&&(t_search(ptr,"height:")!= 0)){
- sscanf(ptr,"%s %x", sbuf1, &height);
- fd_height = TRUE; fd_all ++;
- continue;
- }
- } /* while */
-
- /*
- * Fill the data Structure for this message
- */
- bytes = length * 4;
- attributes.size = (float) height * width;
- attributes.bytes = bytes;
- update_profile(num, & attributes);
- FillMsgStats(& RequestStats[num], current_time,
- (long) height * width, bytes);
- return (bytes);
- } /* ClearArea */
- /*
- * CopyArea: Opcode 62
- * Size: Area of image (height * width).
- */
- long CopyArea(fp, num, current_time)
- FILE *fp; /* Data stream */
- int num; /* Number of the request */
- long current_time; /* Current time in ms */
- {
- XprofGCvalues *gcval;
- long bytes;
- int max_slots = 4; /* Maximum number of data slots to fill */
- int length, width, height;
- long gcid;
- Boolean fd_length = FALSE, fd_width = FALSE, fd_height = FALSE;
- Boolean fd_gcid = FALSE;
- int fd_all=0; /* All found ? */
- char *ptr;
-
- if (RequestStats[num].invoked == FALSE)
- InitMsgStats(&RequestStats[num],current_time,RequestType[num].detailed,
- RequestType[num].size_grain);
- /*
- * Get a record and fill all the slots
- */
- while (fd_all < max_slots) {
- if (fgets(in_string,MAXSTRINGSIZE,fp) == NULL)
- return(0);
- _LINE_NUM++;
- ptr = in_string;
- while (isspace(*ptr)) ptr++; /* Remove leading white space */
- if ((fd_length==FALSE) && (t_search(ptr,"request length:")!= 0)) {
- sscanf(ptr,"%s %s %x", sbuf1, sbuf2, &length);
- fd_length = TRUE; fd_all ++;
- continue;
- }
- else if ((fd_gcid==FALSE)&&(t_search(ptr,"gc:")!= 0)){
- sscanf(ptr,"%s %s %lx", sbuf1, sbuf2, &gcid);
- fd_gcid = TRUE; fd_all ++;
- gcval=get_gcval(gcid);
- continue;
- }
- else if ((fd_width==FALSE)&&(t_search(ptr,"width:")!= 0)){
- sscanf(ptr,"%s %x", sbuf1, &width);
- fd_width = TRUE; fd_all ++;
- continue;
- }
- else if ((fd_height==FALSE)&&(t_search(ptr,"height:")!= 0)){
- sscanf(ptr,"%s %x", sbuf1, &height);
- fd_height = TRUE; fd_all ++;
- continue;
- }
- } /* while */
-
- /*
- * Fill the data Structure for this message
- */
- attributes.gcval = gcval;
- bytes = length * 4;
- attributes.size = (float) height * width;
- attributes.bytes = bytes;
- update_profile(num, & attributes);
- FillMsgStats(& RequestStats[num], current_time,
- (long) height * width, bytes);
- return (bytes);
- } /* CopyArea */
-
- /*
- * CopyPlane: Opcode 63
- * Size: Area of the section to be copied.
- */
- long CopyPlane(fp, num, current_time)
- FILE *fp; /* Data stream */
- int num; /* Number of the request */
- long current_time; /* Current time in ms */
- {
- XprofGCvalues *gcval;
- long bytes;
- int max_slots = 4; /* Maximum number of data slots to fill */
- int length, width, height;
- long gcid;
- Boolean fd_length = FALSE, fd_width = FALSE, fd_height = FALSE;
- Boolean fd_gcid = FALSE;
- int fd_all=0; /* All found ? */
- char *ptr;
-
- if (RequestStats[num].invoked == FALSE)
- InitMsgStats(&RequestStats[num],current_time,RequestType[num].detailed,
- RequestType[num].size_grain);
- /*
- * Get a record and fill all the slots
- */
- while (fd_all < max_slots) {
- if (fgets(in_string,MAXSTRINGSIZE,fp) == NULL)
- return(0);
- _LINE_NUM++;
- ptr = in_string;
- while (isspace(*ptr)) ptr++; /* Remove leading white space */
- if ((fd_length==FALSE) && (t_search(ptr,"request length:")!= 0)) {
- sscanf(ptr,"%s %s %x", sbuf1, sbuf2, &length);
- fd_length = TRUE; fd_all ++;
- continue;
- }
- else if ((fd_gcid==FALSE)&&(t_search(ptr,"gc:")!= 0)){
- sscanf(ptr,"%s %s %lx", sbuf1, sbuf2, &gcid);
- fd_gcid = TRUE; fd_all ++;
- gcval=get_gcval(gcid);
- continue;
- }
- else if ((fd_width==FALSE)&&(t_search(ptr,"width:")!= 0)){
- sscanf(ptr,"%s %x", sbuf1, &width);
- fd_width = TRUE; fd_all ++;
- continue;
- }
- else if ((fd_height==FALSE)&&(t_search(ptr,"height:")!= 0)){
- sscanf(ptr,"%s %x", sbuf1, &height);
- fd_height = TRUE; fd_all ++;
- continue;
- }
- } /* while */
-
- /*
- * Fill the data Structure for this message
- */
- attributes.gcval = gcval;
- bytes = length * 4;
- attributes.size = (float) height * width;
- attributes.bytes = bytes;
- update_profile(num, & attributes);
- FillMsgStats(& RequestStats[num], current_time,
- (long) height * width, bytes);
- return (bytes);
- } /* CopyPlane */
-
- /*
- * PolyPoint: Opcode 64
- * Size: Number of points.
- */
- long PolyPoint(fp, num, current_time)
- FILE *fp; /* Data stream */
- int num; /* Number of the request */
- long current_time; /* Current time in ms */
- {
- XprofGCvalues *gcval;
- long bytes;
- int max_slots = 3; /* Maximum number of data slots to fill */
- int length, numpoints;
- long gcid;
- Boolean fd_length = FALSE, fd_points = FALSE;
- Boolean fd_gcid = FALSE;
- int fd_all=0; /* All found ? */
- int i, x, y;
- char *ptr;
-
- if (RequestStats[num].invoked == FALSE)
- InitMsgStats(&RequestStats[num],current_time,RequestType[num].detailed,
- RequestType[num].size_grain);
- /*
- * Get a record and fill all the slots
- */
- while (fd_all < max_slots) {
- if (fgets(in_string,MAXSTRINGSIZE,fp) == NULL)
- return(0);
- _LINE_NUM++;
- ptr = in_string;
- while (isspace(*ptr)) ptr++; /* Remove leading white space */
- if ((fd_length==FALSE) && (t_search(ptr,"request length:")!= 0)) {
- sscanf(ptr,"%s %s %x", sbuf1, sbuf2, &length);
- fd_length = TRUE; fd_all ++;
- continue;
- }
- else if ((fd_gcid==FALSE)&&(t_search(ptr,"gc:")!= 0)){
- sscanf(ptr,"%s %s %lx", sbuf1, sbuf2, &gcid);
- fd_gcid = TRUE; fd_all ++;
- gcval=get_gcval(gcid);
- continue;
- }
- else if ((fd_points==FALSE)&&(t_search(ptr,"points:")!= 0)){
- sscanf(ptr,"%s %s", sbuf1, sbuf2);
- numpoints = atoi(&sbuf2[1]);/* The "points" field is base 10 !! */
- fd_points = TRUE; fd_all ++;
- for (i = 0; i < numpoints ;i++) { /* Read in each point */
- fscanf(fp, "%s %x", sbuf1, &x); _LINE_NUM++; /* X */
- fscanf(fp, "%s %x", sbuf1, &y); _LINE_NUM++; /* Y */
- fscanf(fp, "%s", sbuf1); _LINE_NUM++; /* Junk */
- }
- continue;
- }
- } /* while */
-
- /*
- * Fill the data Structure for this message
- */
- attributes.gcval = gcval;
- bytes = length * 4;
- attributes.size = (float) numpoints;
- attributes.bytes = bytes;
- update_profile(num, & attributes);
- FillMsgStats(& RequestStats[num], current_time, (long) numpoints, bytes);
- return (bytes);
- } /* PolyPoint */
-
- /*
- * PolyLine: Opcode 66
- * (Draw a connected line between the points listed).
- * Size: The length of each line is registered.
- */
- long PolyLine(fp, num, current_time)
- FILE *fp; /* Data stream */
- int num; /* Number of the request */
- long current_time; /* Current time in ms */
- {
- XprofGCvalues *gcval;
- long bytes;
- int max_slots = 3; /* Maximum number of data slots to fill */
- int length, points;
- long gcid;
- Boolean fd_length = FALSE, fd_points = FALSE;
- Boolean fd_gcid = FALSE;
- int fd_all=0; /* All found ? */
- char *ptr;
- int i, x, y, old_x = 0, old_y = 0;
- double line_length;
-
- if (RequestStats[num].invoked == FALSE)
- InitMsgStats(&RequestStats[num],current_time,RequestType[num].detailed,
- RequestType[num].size_grain);
- /*
- * Get a record and fill all the slots
- */
- while (fd_all < max_slots) {
- if (fgets(in_string,MAXSTRINGSIZE,fp) == NULL)
- return(0);
- _LINE_NUM++;
- ptr = in_string;
- while (isspace(*ptr)) ptr++; /* Remove leading white space */
- if ((fd_length==FALSE) && (t_search(ptr,"request length:")!= 0)) {
- sscanf(ptr,"%s %s %x", sbuf1, sbuf2, &length);
- fd_length = TRUE; fd_all ++;
- continue;
- }
- else if ((fd_gcid==FALSE)&&(t_search(ptr,"gc:")!= 0)){
- sscanf(ptr,"%s %s %lx", sbuf1, sbuf2, &gcid);
- fd_gcid = TRUE; fd_all ++;
- gcval=get_gcval(gcid);
- continue;
- }
- else if ((fd_points==FALSE)&&(t_search(ptr,"points:")!= 0)){
- sscanf(ptr,"%s %s", sbuf1, sbuf2);
- points = atoi(&sbuf2[1]); /* The "points" field is base 10 !! */
- fd_points = TRUE; fd_all ++;
- for (i = 0; i < points ;i++) { /* Read in each point */
- fscanf(fp, "%s %x", sbuf1, &x); _LINE_NUM++; /* X1 */
- fscanf(fp, "%s %x", sbuf1, &y); _LINE_NUM++; /* Y1 */
- fscanf(fp, "%s", sbuf1) ; _LINE_NUM++; /* Junk */
-
- if (i > 0 ) { /* It takes two to form a line */
- line_length = sqrt( (double) ((old_x - x)*(old_x - x))
- + ((old_y - y)*(old_y - y)) );
- /* Now fill the data structure for all except the bytes*/
- FillMsgStats(&RequestStats[num], current_time,
- (long) line_length, (long) -1);
- attributes.size = length;
- attributes.bytes = -1;
- update_profile(num, & attributes);
- }
- old_x = x; old_y = y;
- }
- }
- } /* while */
- /*
- * Fill the data Structure for this message
- * Only the bytes are filled here
- */
- attributes.gcval = gcval;
- bytes = length * 4;
- attributes.size = -1.0;
- attributes.bytes = bytes;
- update_profile(num, & attributes);
- FillMsgStats(&RequestStats[num], (long) -1, (long) -1, bytes);
- return (bytes);
- } /* PolyLine */
-
- /*
- * PolySegment: Opcode 66
- * Size: The length of each segment is registered.
- */
- long PolySegment(fp, num, current_time)
- FILE *fp; /* Data stream */
- int num; /* Number of the request */
- long current_time; /* Current time in ms */
- {
- XprofGCvalues *gcval;
- long bytes;
- int max_slots = 3; /* Maximum number of data slots to fill */
- int length, segments;
- long gcid;
- Boolean fd_length = FALSE, fd_segments = FALSE;
- Boolean fd_gcid = FALSE;
- int fd_all=0; /* All found ? */
- char *ptr;
- int i, x1, y1, x2, y2;
- double seg_length;
-
- if (RequestStats[num].invoked == FALSE)
- InitMsgStats(&RequestStats[num],current_time,RequestType[num].detailed,
- RequestType[num].size_grain);
- /*
- * Get a record and fill all the slots
- */
- while (fd_all < max_slots) {
- if (fgets(in_string,MAXSTRINGSIZE,fp) == NULL)
- return(0);
- _LINE_NUM++;
- ptr = in_string;
- while (isspace(*ptr)) ptr++; /* Remove leading white space */
- if ((fd_length==FALSE) && (t_search(ptr,"request length:")!= 0)) {
- sscanf(ptr,"%s %s %x", sbuf1, sbuf2, &length);
- fd_length = TRUE; fd_all ++;
- continue;
- }
- else if ((fd_gcid==FALSE)&&(t_search(ptr,"gc:")!= 0)){
- sscanf(ptr,"%s %s %lx", sbuf1, sbuf2, &gcid);
- fd_gcid = TRUE; fd_all ++;
- gcval=get_gcval(gcid);
- continue;
- }
- else if ((fd_segments==FALSE)&&(t_search(ptr,"segments:")!= 0)){
- sscanf(ptr,"%s %s", sbuf1, sbuf2);
- segments = atoi(&sbuf2[1]); /* The "segments" field is base 10 !! */
- fd_segments = TRUE; fd_all ++;
- for (i = 0; i < segments ;i++) { /* Read in each segment */
- fscanf(fp, "%s %x", sbuf1, &x1); _LINE_NUM++; /* X1 */
- fscanf(fp, "%s %x", sbuf1, &y1); _LINE_NUM++; /* Y1 */
- fscanf(fp, "%s %x", sbuf1, &x2); _LINE_NUM++; /* X2 */
- fscanf(fp, "%s %x", sbuf1, &y2); _LINE_NUM++; /* Y2 */
- fscanf(fp, "%s", sbuf1); _LINE_NUM++; /* Junk */
- /* Length of this segment ? */
- seg_length = sqrt((double) ((x2 - x1)*(x2 - x1))
- +((y2 - y1)*(y2 - y1)));
- /* Now fill the data structure for all values except the bytes*/
- FillMsgStats(&RequestStats[num], current_time,
- (long) seg_length, (long) -1);
- attributes.size = length;
- attributes.bytes = -1;
- update_profile(num, & attributes);
- }
- }
- } /* while */
- /*
- * Fill the data Structure for this message
- * Only the bytes are filled here
- */
- attributes.gcval = gcval;
- bytes = length * 4;
- attributes.size = -1.0;
- attributes.bytes = bytes;
- update_profile(num, & attributes);
- FillMsgStats(&RequestStats[num], (long) -1, (long) -1, bytes);
- return (bytes);
- } /* PolySegment */
-
- /*
- * PolyRectangle: Opcode 67
- * Size: The perimeter of each rectangle is registered, i.e., 2*(width + height)
- */
- long PolyRectangle(fp, num, current_time)
- FILE *fp; /* Data stream */
- int num; /* Number of the request */
- long current_time; /* Current time in ms */
- {
- XprofGCvalues *gcval;
- long bytes;
- int max_slots = 3; /* Maximum number of data slots to fill */
- int length, rectangles;
- long gcid;
- Boolean fd_length = FALSE, fd_rectangles = FALSE;
- Boolean fd_gcid = FALSE;
- int fd_all=0; /* All found ? */
- char *ptr;
- int i, x, y, width, height;
-
- if (RequestStats[num].invoked == FALSE)
- InitMsgStats(&RequestStats[num],current_time,RequestType[num].detailed,
- RequestType[num].size_grain);
- /*
- * Get a record and fill all the slots
- */
- while (fd_all < max_slots) {
- if (fgets(in_string,MAXSTRINGSIZE,fp) == NULL)
- return(0);
- _LINE_NUM++;
- ptr = in_string;
- while (isspace(*ptr)) ptr++; /* Remove leading white space */
- if ((fd_length==FALSE) && (t_search(ptr,"request length:")!= 0)) {
- sscanf(ptr,"%s %s %x", sbuf1, sbuf2, &length);
- fd_length = TRUE; fd_all ++;
- continue;
- }
- else if ((fd_gcid==FALSE)&&(t_search(ptr,"gc:")!= 0)){
- sscanf(ptr,"%s %s %lx", sbuf1, sbuf2, &gcid);
- fd_gcid = TRUE; fd_all ++;
- gcval=get_gcval(gcid);
- continue;
- }
- else if ((fd_rectangles==FALSE)&&(t_search(ptr,"rectangles:")!= 0)){
- sscanf(ptr,"%s %s", sbuf1, sbuf2);
- rectangles = atoi(&sbuf2[1]);/*The "rectangles" field is base 10 !*/
- fd_rectangles = TRUE; fd_all ++;
- for (i = 0; i < rectangles ;i++) { /* Read in each rectangle */
- fscanf(fp,"%s %x", sbuf1,&x); _LINE_NUM++; /* X */
- fscanf(fp,"%s %x", sbuf1,&y); _LINE_NUM++; /* Y */
- fscanf(fp,"%s %x", sbuf1,&width); _LINE_NUM++; /* width */
- fscanf(fp,"%s %x", sbuf1,&height); _LINE_NUM++; /* height */
- fscanf(fp, "%s", sbuf1); _LINE_NUM++; /* Junk */
- /* Now fill the data structure for all values except the bytes*/
- FillMsgStats(&RequestStats[num], current_time,
- (long) 2*(height+width), (long) -1);
- attributes.bytes = -1;
- attributes.size = 2 * (height + width);
- update_profile(num, &attributes);
- }
- }
- } /* while */
- /*
- * Fill the data Structure for this message
- * Only the bytes are filled here
- */
- attributes.gcval = gcval;
- bytes = length * 4;
- attributes.bytes = bytes;
- attributes.size = -1.0;
- update_profile(num, &attributes);
- FillMsgStats(&RequestStats[num], (long) -1, (long) -1, bytes);
- return (bytes);
- }
-
- /*
- * PolyFillRectangle: Opcode 70
- * Size: The area of each rectangle is registered, i.e., (width * height)
- */
- long PolyFillRectangle(fp, num, current_time)
- FILE *fp; /* Data stream */
- int num; /* Number of the request */
- long current_time; /* Current time in ms */
- {
- XprofGCvalues *gcval;
- long bytes;
- int max_slots = 3; /* Maximum number of data slots to fill */
- int length, rectangles;
- long gcid;
- Boolean fd_length = FALSE, fd_rectangles = FALSE;
- Boolean fd_gcid = FALSE;
- int fd_all=0; /* All found ? */
- char *ptr;
- int i, x, y, width, height;
-
- if (RequestStats[num].invoked == FALSE)
- InitMsgStats(&RequestStats[num],current_time,RequestType[num].detailed,
- RequestType[num].size_grain);
- /*
- * Get a record and fill all the slots
- */
- while (fd_all < max_slots) {
- if (fgets(in_string,MAXSTRINGSIZE,fp) == NULL)
- return(0);
- _LINE_NUM++;
- ptr = in_string;
- while (isspace(*ptr)) ptr++; /* Remove leading white space */
- if ((fd_length==FALSE) && (t_search(ptr,"request length:")!= 0)) {
- sscanf(ptr,"%s %s %x", sbuf1, sbuf2, &length);
- fd_length = TRUE; fd_all ++;
- continue;
- }
- else if ((fd_gcid==FALSE)&&(t_search(ptr,"gc:")!= 0)){
- sscanf(ptr,"%s %s %lx", sbuf1, sbuf2, &gcid);
- fd_gcid = TRUE; fd_all ++;
- gcval=get_gcval(gcid);
- continue;
- }
- else if ((fd_rectangles==FALSE)&&(t_search(ptr,"rectangles:")!= 0)){
- sscanf(ptr,"%s %s", sbuf1, sbuf2);
- rectangles = atoi(&sbuf2[1]);/*The "rectangles" field is base 10 !*/
- fd_rectangles = TRUE; fd_all ++;
- for (i = 0; i < rectangles ;i++) { /* Read in each rectangle */
- fscanf(fp,"%s %x", sbuf1,&x); _LINE_NUM++; /* X */
- fscanf(fp,"%s %x", sbuf1,&y); _LINE_NUM++; /* Y */
- fscanf(fp,"%s %x", sbuf1,&width); _LINE_NUM++; /* width */
- fscanf(fp,"%s %x", sbuf1,&height); _LINE_NUM++; /* height */
- fscanf(fp, "%s", sbuf1); _LINE_NUM++; /* Junk */
- /* Now fill the data structure for all values except the bytes*/
- FillMsgStats(&RequestStats[num], current_time,
- (long) (height*width), (long) -1);
- attributes.bytes = -1;
- attributes.size = height * width;
- update_profile(num, &attributes);
- }
- }
- } /* while */
- /*
- * Fill the data Structure for this message
- * Only the bytes are filled here
- */
- attributes.gcval = gcval;
- bytes = length * 4;
- attributes.bytes = bytes;
- attributes.size = height * width;
- update_profile(num, &attributes);
- FillMsgStats(&RequestStats[num], (long) -1, (long) -1, bytes);
- return (bytes);
- } /* PolyFillRectangle */
-
-
- /*
- * PutImage: Opcode 72
- * Size: Area of image (in bytes) i.e. (height * width * depth) / 8
- */
- long PutImage(fp, num, current_time)
- FILE *fp; /* Data stream */
- int num; /* Number of the request */
- long current_time; /* Current time in ms */
- {
- XprofGCvalues *gcval;
- long bytes;
- int max_slots = 5; /* Maximum number of data slots to fill */
- int length, width, height, depth;
- long gcid;
- Boolean fd_length=FALSE, fd_width=FALSE, fd_height=FALSE, fd_depth=FALSE;
- Boolean fd_gcid = FALSE;
- int fd_all=0; /* All found ? */
- char *ptr;
-
- if (RequestStats[num].invoked == FALSE)
- InitMsgStats(&RequestStats[num],current_time,RequestType[num].detailed,
- RequestType[num].size_grain);
- /*
- * Fetch records until all the slots are filled.
- */
- while (fd_all < max_slots) {
- if (fgets(in_string,MAXSTRINGSIZE,fp) == NULL)
- return(0);
- _LINE_NUM++;
- ptr = in_string;
- while (isspace(*ptr)) /* Remove leading white space */
- ptr++;
- if ((fd_length==FALSE) && (t_search(ptr,"request length:")!= 0)) {
- sscanf(ptr,"%s %s %x", sbuf1, sbuf2, &length);
- fd_length = TRUE; fd_all ++;
- continue;
- }
- else if ((fd_gcid==FALSE)&&(t_search(ptr,"gc:")!= 0)){
- sscanf(ptr,"%s %s %lx", sbuf1, sbuf2, &gcid);
- fd_gcid = TRUE; fd_all ++;
- gcval=get_gcval(gcid);
- continue;
- }
- else if ((fd_width==FALSE)&&(t_search(ptr,"width:")!= 0)) {
- sscanf(ptr,"%s %x", sbuf1, &width);
- fd_width = TRUE; fd_all ++;
- continue;
- }
- else if ((fd_height==FALSE)&&(t_search(ptr,"height:")!= 0)) {
- sscanf(ptr,"%s %x", sbuf1, &height);
- fd_height = TRUE; fd_all ++;
- continue;
- }
- else if ((fd_depth==FALSE)&&(t_search(ptr,"depth:")!= 0)) {
- sscanf(ptr,"%s %x", sbuf1, &depth);
- fd_depth = TRUE; fd_all ++;
- continue;
- }
- } /* while */
-
- /*
- * Fill the data Structure for this message
- */
- attributes.gcval = gcval;
- bytes = length * 4;
- attributes.bytes = bytes;
- attributes.size = (float) (height * width * depth) / 8;
- update_profile(num, &attributes);
- FillMsgStats(& RequestStats[num], current_time,
- (long) (height * width * depth) / 8, bytes);
- return (bytes);
- } /* PutImage */
-
- /*
- * GetImage: Opcode 73
- * Size: Area of image i.e. (height * width)
- */
- long GetImage(fp, num, current_time)
- FILE *fp; /* Data stream */
- int num; /* Number of the request */
- long current_time; /* Current time in ms */
- {
- long bytes;
- int max_slots = 3; /* Maximum number of data slots to fill */
- int length, width, height;
- Boolean fd_length = FALSE, fd_width = FALSE, fd_height = FALSE;
- int fd_all=0; /* All found ? */
- char *ptr;
-
- if (RequestStats[num].invoked == FALSE)
- InitMsgStats(&RequestStats[num],current_time,RequestType[num].detailed,
- RequestType[num].size_grain);
- /*
- * Get a record and fill all the slots
- */
- while (fd_all < max_slots) {
- if (fgets(in_string,MAXSTRINGSIZE,fp) == NULL)
- return(0);
- _LINE_NUM++;
- ptr = in_string;
- while (isspace(*ptr)) ptr++; /* Remove leading white space */
- if ((fd_length==FALSE) && (t_search(ptr,"request length:")!= 0)) {
- sscanf(ptr,"%s %s %x", sbuf1, sbuf2, &length);
- fd_length = TRUE; fd_all ++;
- continue;
- }
- else if ((fd_width==FALSE)&&(t_search(ptr,"width:")!= 0)){
- sscanf(ptr,"%s %x", sbuf1, &width);
- fd_width = TRUE; fd_all ++;
- continue;
- }
- else if ((fd_height==FALSE)&&(t_search(ptr,"height:")!= 0)){
- sscanf(ptr,"%s %x", sbuf1, &height);
- fd_height = TRUE; fd_all ++;
- continue;
- }
- } /* while */
-
- /*
- * Fill the data Structure for this message
- */
- bytes = length * 4;
- attributes.bytes = bytes;
- attributes.size = (float) height * width;
- update_profile(num, &attributes);
- FillMsgStats(& RequestStats[num], current_time,
- (long) height * width, bytes);
- return (bytes);
- } /* GetImage */
-
- /*
- * PolyText8: Opcode 74
- * Size: length of string
- */
- long PolyText8(fp, num, current_time)
- FILE *fp; /* Data stream */
- int num; /* Number of the request */
- long current_time; /* Current time in ms */
- {
- XprofGCvalues *gcval;
- long bytes;
- int max_slots = 3; /* Maximum number of data slots to fill */
- int length; /* length and string are the two slots */
- char *string;
- long gcid;
- Boolean fd_length = FALSE, fd_string = FALSE, fd_gcid=FALSE;
- int fd_all=0; /* All found ? */
- char *ptr;
- int strlength;
-
- if (RequestStats[num].invoked == FALSE)
- InitMsgStats(&RequestStats[num],current_time,RequestType[num].detailed,
- RequestType[num].size_grain);
- /*
- * Get a record and fill all the slots
- */
- while (fd_all < max_slots) {
- if (fgets(in_string,MAXSTRINGSIZE,fp) == NULL)
- return(0);
- _LINE_NUM++;
- ptr = in_string;
- while (isspace(*ptr)) ptr++; /* Remove leading white space */
- if ((fd_length==FALSE) && (t_search(ptr,"request length:")!= 0)) {
- sscanf(ptr,"%s %s %x", sbuf1, sbuf2, &length);
- fd_length = TRUE; fd_all ++;
- continue;
- }
- else if ((fd_gcid==FALSE)&&(t_search(ptr,"gc:")!= 0)){
- sscanf(ptr,"%s %s %lx", sbuf1, sbuf2, &gcid);
- fd_gcid = TRUE; fd_all ++;
- gcval=get_gcval(gcid);
- continue;
- }
- else if ((fd_string==FALSE)&&(t_search(ptr,"text item 8 string:")!=0)){
- string = ptr + 21;
- strlength = strlen(string);
- while ((string[strlength-1]=='\n')||(string[strlength-1]=='"')) {
- string[strlength-1] = '\0';
- strlength --;
- }
- fd_string = TRUE; fd_all ++;
- continue;
- }
- } /* while */
-
- /*
- * Fill the data Structure for this message
- */
- attributes.gcval=gcval;
- bytes = length * 4;
- attributes.bytes = bytes;
- attributes.size = (float) strlength;
- update_profile(num, &attributes);
- FillMsgStats(& RequestStats[num], current_time, (long) strlength, bytes);
- return (bytes);
- } /* PolyText8 */
-
- /*
- * PolyText16: Opcode 75
- * Size: length of string
- */
- long PolyText16(fp, num, current_time)
- FILE *fp; /* Data stream */
- int num; /* Number of the request */
- long current_time; /* Current time in ms */
- {
- XprofGCvalues *gcval;
- long bytes;
- int max_slots = 3; /* Maximum number of data slots to fill */
- int length; /* length and string are the two slots */
- char *string;
- long gcid;
- Boolean fd_length = FALSE, fd_string = FALSE, fd_gcid = FALSE;
- int fd_all=0; /* All found ? */
- char *ptr;
- int strlength;
-
- if (RequestStats[num].invoked == FALSE)
- InitMsgStats(&RequestStats[num],current_time,RequestType[num].detailed,
- RequestType[num].size_grain);
- /*
- * Get a record and fill all the slots
- */
- while (fd_all < max_slots) {
- if (fgets(in_string,MAXSTRINGSIZE,fp) == NULL)
- return(0);
- _LINE_NUM++;
- ptr = in_string;
- while (isspace(*ptr)) ptr++; /* Remove leading white space */
- if ((fd_length==FALSE) && (t_search(ptr,"request length:")!= 0)) {
- sscanf(ptr,"%s %s %x", sbuf1, sbuf2, &length);
- fd_length = TRUE; fd_all ++;
- continue;
- }
- else if ((fd_gcid==FALSE)&&(t_search(ptr,"gc:")!= 0)){
- sscanf(ptr,"%s %s %lx", sbuf1, sbuf2, &gcid);
- fd_gcid = TRUE; fd_all ++;
- gcval=get_gcval(gcid);
- continue;
- }
- else if ((fd_string==FALSE)&&(t_search(ptr,"text item 16 string:")!=0)){
- string = ptr + 22;
- strlength = strlen(string);
- while ((string[strlength-1]=='\n')||(string[strlength-1]=='"')) {
- string[strlength-1] = '\0';
- strlength --;
- }
- fd_string = TRUE; fd_all ++;
- continue;
- }
- } /* while */
-
- /*
- * Fill the data Structure for this message
- */
- attributes.gcval = gcval;
- bytes = length * 4;
- attributes.bytes = bytes;
- attributes.size = (float) strlength;
- update_profile(num, &attributes);
- FillMsgStats(& RequestStats[num], current_time, (long) strlength, bytes);
- return (bytes);
- } /* PolyText16 */
-
-
-
- /*
- * ImageText8: Opcode 76
- * Size: length of string
- */
- long ImageText8(fp, num, current_time)
- FILE *fp; /* Data stream */
- int num; /* Number of the request */
- long current_time; /* Current time in ms */
- {
- XprofGCvalues *gcval;
- long bytes;
- int max_slots = 3; /* Maximum number of data slots to fill */
- int length; /* length and string are the two slots */
- char *string;
- long gcid;
- Boolean fd_length = FALSE, fd_string = FALSE, fd_gcid=FALSE;
- int fd_all=0; /* All found ? */
- char *ptr;
- int strlength;
-
- if (RequestStats[num].invoked == FALSE)
- InitMsgStats(&RequestStats[num],current_time,RequestType[num].detailed,
- RequestType[num].size_grain);
- /*
- * Get a record and fill all the slots
- */
- while (fd_all < max_slots) {
- if (fgets(in_string,MAXSTRINGSIZE,fp) == NULL)
- return(0);
- _LINE_NUM++;
- ptr = in_string;
- while (isspace(*ptr)) ptr++; /* Remove leading white space */
- if ((fd_length==FALSE) && (t_search(ptr,"request length:")!= 0)) {
- sscanf(ptr,"%s %s %x", sbuf1, sbuf2, &length);
- fd_length = TRUE; fd_all ++;
- continue;
- }
- else if ((fd_gcid==FALSE)&&(t_search(ptr,"gc:")!= 0)){
- sscanf(ptr,"%s %s %lx", sbuf1, sbuf2, &gcid);
- fd_gcid = TRUE; fd_all ++;
- gcval=get_gcval(gcid);
- continue;
- }
- else if ((fd_string==FALSE)&&(t_search(ptr,"string:")!= 0)){
- string = ptr + 9;
- strlength = strlen(string);
- while ((string[strlength-1]=='\n')||(string[strlength-1]=='"')) {
- string[strlength-1] = '\0';
- strlength --;
- }
- fd_string = TRUE; fd_all ++;
- continue;
- }
- } /* while */
-
- /*
- * Fill the data Structure for this message
- */
- attributes.gcval = gcval;
- bytes = length * 4;
- attributes.bytes = bytes;
- attributes.size = (float) strlength;
- update_profile(num, &attributes);
- FillMsgStats(& RequestStats[num], current_time,
- (long) strlength, bytes);
- return (bytes);
- } /* ImageText8 */
-
- /*
- * ImageText16: Opcode 77
- * Size: length of string
- */
- long ImageText16(fp, num, current_time)
- FILE *fp; /* Data stream */
- int num; /* Number of the request */
- long current_time; /* Current time in ms */
- {
- XprofGCvalues *gcval;
- long bytes;
- int max_slots = 3; /* Maximum number of data slots to fill */
- int length; /* length and string are the two slots */
- char *string;
- long gcid;
- Boolean fd_length = FALSE, fd_string = FALSE, fd_gcid = FALSE;
- int fd_all=0; /* All found ? */
- char *ptr;
- int strlength;
-
-
- if (RequestStats[num].invoked == FALSE)
- InitMsgStats(&RequestStats[num],current_time,RequestType[num].detailed,
- RequestType[num].size_grain);
- /*
- * Get a record and fill all the slots
- */
- while (fd_all < max_slots) {
- if (fgets(in_string,MAXSTRINGSIZE,fp) == NULL)
- return(0);
- _LINE_NUM++;
- ptr = in_string;
- while (isspace(*ptr)) ptr++; /* Remove leading white space */
- if ((fd_length==FALSE) && (t_search(ptr,"request length:")!= 0)) {
- sscanf(ptr,"%s %s %x", sbuf1, sbuf2, &length);
- fd_length = TRUE; fd_all ++;
- continue;
- }
- else if ((fd_gcid==FALSE)&&(t_search(ptr,"gc:")!= 0)){
- sscanf(ptr,"%s %s %lx", sbuf1, sbuf2, &gcid);
- fd_gcid = TRUE; fd_all ++;
- gcval=get_gcval(gcid);
- continue;
- }
- else if ((fd_string==FALSE)&&(t_search(ptr,"string:")!= 0)){
- string = ptr + 9;
- strlength = strlen(string);
- while ((string[strlength-1]=='\n')||(string[strlength-1]=='"')) {
- string[strlength-1] = '\0';
- strlength --;
- }
- fd_string = TRUE; fd_all ++;
- continue;
- }
- } /* while */
-
- /*
- * Fill the data Structure for this message
- */
- attributes.gcval = gcval;
- bytes = length * 4;
- attributes.bytes = bytes;
- attributes.size = (float) strlength;
- update_profile(num, &attributes);
- FillMsgStats(& RequestStats[num], current_time,
- (long) strlength, bytes);
- return (bytes);
- } /* ImageText16 */
-
-